package com.hengxinguotong.zhihuichengjian.notification;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;

import com.hengxinguotong.zhihuichengjian.R;
import com.hengxinguotong.zhihuichengjian.floatwindow.MyWindowManager;
import com.hengxinguotong.zhihuichengjian.ui.MessageActivity;

/**
 * Created by Administrator on 2017/12/14.
 */

public class NotificationWindow extends RelativeLayout {

    /**
     * 记录大悬浮窗的宽度
     */
    public static int viewWidth;

    /**
     * 记录大悬浮窗的高度
     */
    public static int viewHeight;

    public NotificationWindow(final Context context) {
        super(context);
        LayoutInflater.from(context).inflate(R.layout.notification_layout, this);
        RelativeLayout mainLayout = (RelativeLayout) findViewById(R.id.main_layout);
        viewWidth = mainLayout.getLayoutParams().width;
        viewHeight = mainLayout.getLayoutParams().height;
        mainLayout.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(context, MessageActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(intent);
                MyWindowManager.removeWindow(context);
            }
        });
    }
}
